<template>
  <div>
    <span>我是哥哥 , 开的是{{car}} </span>
    <button @click="changeCar">换车</button>
  </div>
</template>

<script>
import PubSub from "pubsub-js";
export default {
  data() {
    return {
      car: '奥托'
    }
  },
  methods: {
    changeCar(){
      this.car = '兰博基尼'

      // 传值
      PubSub.publish('getCarFn',this.car)

    }
  },
}
</script>

<style>

</style>